export {};
const app =  getApp();

  

Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  data: {
    isAuthUserInfo:false,
    showLogin:false,
  },
  lifetimes: {
    async attached() {
      //检测是否授权登录，如果没有授权，那么弹窗
      const isAuthUserInfo =  (await wx.getSetting()).authSetting["scope.userInfo"];
      console.log(isAuthUserInfo);
      this.setData({
        showLogin:isAuthUserInfo?true:true,
        isAuthUserInfo:isAuthUserInfo
      });
    },
  },

  methods: {
    getUserInfo: function (e: any) {
      console.log(e.detail.userInfo)
      const userInfo = e.detail.userInfo;
      app.globalData.userInfo = userInfo as WechatMiniprogram.UserInfo;
      this.setData({
        showLogin:userInfo?false:true,
      });
    },
    closeLoginDialog(){
      this.setData({
        showLogin:false
      })
    }
  }
  }
);